import { rest } from 'msw';
import { res } from './res';

// Define handlers that catch the corresponding requests and returns the mock data.
export const handlers = [
	rest.post('/v7/login', (request, response, ctx) => {
		return res(
			ctx.status(200),
			ctx.json({ loginName: 'admin', password: '123456' })
		);
	}),
	rest.get('/v7/logout', (request, response, ctx) => {
		return res(
			ctx.status(200),
			ctx.json({ loginName: 'admin', password: '123456' })
		);
	}),
	rest.get('/appdata', (request, response, ctx) => {
		return res(ctx.status(200), ctx.json({ url: '/appdata' }));
	}),
];
